package com.ojoin.trade.supplyloan_core.web.dao.impl;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.exception.DaoException;
import com.ojoin.trade.common.web.dao.impl.BaseDaoImpl;
import com.ojoin.trade.supplyloan_core.web.dao.TbSlLoanInfoLogDao;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlLoanInfoLog;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlLoanRefundLog;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 15-12-25
 * Time: 下午3:22
 * To change this template use File | Settings | File Templates.
 */
@Repository
public class TbSlLoanInfoLogDaoImpl extends BaseDaoImpl<TbSlLoanInfoLog> implements TbSlLoanInfoLogDao{
    @Override
    public void insertTbSlLoanInfo(TbSlLoanInfoLog logvo) throws BusinessException {
        try{
        insert(logvo);
        }catch (Exception e){
            throw  new DaoException("新增贷款统计表出错");
        }
    }

    @Override
    public List<TbSlLoanInfoLog> queryTbSlLoanInfoLogByJoinid(int idOfTbMerchantUser, Pageable page) throws BusinessException {
        String mapMethodName="selectByJoinid";
        try {
            List list = this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),idOfTbMerchantUser,getPageBounds(page));
            return list ;
        } catch (Exception e) {
            throw new DaoException(String.format("查询用户还款统计表记录出错！语句：%s",
                    getSqlName(mapMethodName)), e);
        }

    }
}
